/*
 * eren_opcode_compile.h
 *
 *  Created on: 2012-7-12
 *      Author: Steve Liu
 *       Email: eshifang@gmail.com
 *   CopyRight: http://www.eshifang.com
 *
 */

#ifndef EREN_OPCODE_COMPILE_H_
#define EREN_OPCODE_COMPILE_H_

static zend_op_array* (*eren_pre_compile_file)(zend_file_handle* file_handle, int type TSRMLS_DC);
static zend_op_array* (*eren_pre_compile_string)(zval *source_string, char *filename TSRMLS_DC);

static zend_op_array* eren_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
	zend_op_array *op_array = NULL;
	int i = 0;

	if((op_array = eren_pre_compile_file(file_handle, type TSRMLS_DC)))
	{
		eren_print_op_array(op_array);
	}

	destroy_op_array(op_array TSRMLS_CC);
	efree(op_array);
	op_array = NULL;

	return NULL;
}
static zend_op_array* eren_compile_string(zval *source_string, char *filename TSRMLS_DC)
{
	zend_op_array *op_array = NULL;

	if((op_array = eren_pre_compile_string(source_string, filename TSRMLS_DC)))
	{
		eren_print_op_array(op_array);
	}

	destroy_op_array(op_array TSRMLS_CC);
	efree(op_array);
	op_array = NULL;

	return NULL;
}

#endif /* EREN_OPCODE_COMPILE_H_ */
